<!-- author -->
<template>
  <div>
  </div>
</template>

<script>
  import {
    mapGetters
  } from 'vuex'
  import {
    Toast
  } from 'mint-ui'
  import {
    GetQueryString
  } from '@/utils'
  export default {
    data() {
      return {
        token: ''
      }
    },
    computed: {
      ...mapGetters([
        'userInfo'
      ])
    },
    created() {
      const wxtoken = GetQueryString('token')
      const code = GetQueryString('msg')
      if (wxtoken && Number(code) === 200) {
        window.localStorage.setItem('share_token', wxtoken)
        const historyUrl = window.sessionStorage.getItem('authUrl')
        // this.$router.replace(historyUrl)
        window.location.href = window.location.origin + '/shareapp' + historyUrl
        //  removeLocalStorage('authUrl')
      } else {
        // 没有拿到后台访问微信返回的token
        Toast('授权失败请关闭网页重新进入')
        window.localStorage.removeItem('share_token')
        window.sessionStorage.removeItem('authUrl')
      }
      // this.token = getLocalStorage('share_token')
      // if (!GetQueryString('token')) {
      //   this.ReturnGetCodeUrl()
      // } else {
      //   const msg = GetQueryString('msg')
      //   if (msg = 200) {
      //     this.token = GetQueryString("token")
      //     setLocalStorage("share_token", this.token)
      //     let url = getLocalStorage("beforeLoginUrl")
      //     this.$router.push(url)
      //     removeLocalStorage("beforeLoginUrl")
      //   }
      // }
    }
  }

</script>
<style lang='scss' scoped>


</style>
